import java.io.IOException;
import java.util.HashMap;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User:38917
 * Date:2025/4/16
 * Time:12:27
 */
public class TCPTranslateSever extends TCPEchoSever {
    //
    HashMap<String,String> hashMap = new HashMap<>();
    //
    public TCPTranslateSever(int port) throws IOException {
        super(port);
        hashMap.put("cat","小猫");
        hashMap.put("dog","小狗");
        hashMap.put("fish","小鱼");
    }
    //
    @Override
    public String process(String request) {
        return hashMap.getOrDefault(request,"您查的单词不存在");
    }
    //
    public static void main(String[] args) throws IOException {
        TCPTranslateSever sever = new TCPTranslateSever(9090);
        sever.start();
    }
}
